#pragma once
#include<QTabWidget>
#include"TableModel.h"
#include<QItemSelection>

class NewAddressTab;
class QWidget;
class QSortFilterProxyModel;
class AddressWidget : public QTabWidget
{
	Q_OBJECT

	public:
		AddressWidget(QWidget* parent =0);
		void readFromFile(const QString& filename);
		void writeToFile(const QString& filename);

	public slots:
		void showAddEntryDialog();
		void addEntry(const QString & name , const QString& address);
		void editEntry();
		void removeEntry();

signals:
		void selectionChanged(const QItemSelection& selected);

	private:
		void setupTabs();

		TableModel * table_;
		NewAddressTab * newAddressTab_;
		QSortFilterProxyModel * proxyModel_;


};
